{% extends "base.html" %}

{% block content %}
<div class="container mt-4">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title mb-0">编辑运输任务</h4>
                </div>
                <div class="card-body">
                    <form method="POST">
                        <div class="mb-3">
                            <label class="form-label">车牌号</label>
                            <input type="text" class="form-control" name="vehicle_number" value="{{ transport.vehicle_number }}" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">司机姓名</label>
                            <input type="text" class="form-control" name="driver_name" value="{{ transport.driver_name }}" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">联系电话</label>
                            <input type="text" class="form-control" name="driver_phone" value="{{ transport.driver_phone }}" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">起点位置</label>
                            <input type="text" class="form-control" name="start_location" value="{{ transport.start_location }}" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">终点位置</label>
                            <input type="text" class="form-control" name="end_location" value="{{ transport.end_location }}" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">开始时间</label>
                            <input type="datetime-local" class="form-control" name="start_time" 
                                   value="{{ transport.start_time.strftime('%Y-%m-%dT%H:%M') }}" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">预计到达时间</label>
                            <input type="datetime-local" class="form-control" name="estimated_arrival_time" 
                                   value="{{ transport.estimated_arrival_time.strftime('%Y-%m-%dT%H:%M') }}" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">当前温度(°C)</label>
                            <input type="number" class="form-control" name="current_temperature" 
                                   value="{{ transport.current_temperature or '' }}" step="0.1"
                                   placeholder="请输入温度，可选">
                        </div>
                        <div class="mb-3">
                            <label class="form-label">当前湿度(%)</label>
                            <input type="number" class="form-control" name="current_humidity" 
                                   value="{{ transport.current_humidity or '' }}" step="0.1"
                                   placeholder="请输入湿度，可选">
                        </div>
                        <div class="mb-3">
                            <label class="form-label">状态</label>
                            <select class="form-select" name="status" required>
                                <option value="preparing" {% if transport.status == 'preparing' %}selected{% endif %}>准备中</option>
                                <option value="in_transit" {% if transport.status == 'in_transit' %}selected{% endif %}>运输中</option>
                                <option value="completed" {% if transport.status == 'completed' %}selected{% endif %}>已完成</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">备注</label>
                            <textarea class="form-control" name="notes" rows="3">{{ transport.notes }}</textarea>
                        </div>
                        <div class="d-grid gap-2">
                            <button type="submit" class="btn btn-primary">保存修改</button>
                            <a href="{{ url_for('storage.transport_list') }}" class="btn btn-secondary">返回</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 